package com.jt.demo02.factory;
import com.jt.demo02.pojo.Dog;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.stereotype.Component;

//利用工厂模式生产对象 工厂工作 Dog对象创建
@Component
public class DogFactory implements FactoryBean<Dog> {
    //创建对象
    @Override
    public Dog getObject() throws Exception {
        //动态变化的
        return new Dog();
    }

    @Override
    public Class<?> getObjectType() {
        return Dog.class;
    }

    //默认都是单例模式
    @Override
    public boolean isSingleton() {
        return FactoryBean.super.isSingleton();
    }
}
